Credit to: https://datascience.stackexchange.com/questions/12840/3d-contour-plot-in-r
# install the package if you have not
#install.packages("plotly")
library(plotly)
packageVersion('plotly')
x = runif(1000)
y = runif(1000)
s <- subplot(
plot_ly(x = x, type = "histogram", showlegend=FALSE),
plotly_empty(),
plot_ly(x = x, y = y, type = "histogram2dcontour", showlegend=FALSE),
plot_ly(y = y, type = "histogram", showlegend=FALSE),
nrows = 2, heights = c(0.2, 0.8), widths = c(0.8, 0.2),
shareX = TRUE, shareY = TRUE, titleX = FALSE, titleY = FALSE
)
No trace type specified and no positional attributes specifiedNo trace type specified:
Based on info supplied, a 'scatter' trace seems appropriate.
Read more about this trace type -> https://plot.ly/r/reference/#scatter
No scatter mode specifed:
Setting the mode to markers
Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode
layout(s)